/*
 * 组件注释
 * @Author: machinist_wq
 * @Date: 2022-06-30 16:25:39
 * @LastEditors: machinist_wq
 * @LastEditTime: 2022-07-01 15:53:20
 * @Description: searchForm组件展示
 * 人生无常！大肠包小肠......
 */
"use strict";
import { FC, Fragment, ReactElement } from "react";
import { Input } from "antd";
import SearchForm from "@/component/searchForm";
import { basicCode, resetCode, customCode } from "./codeConf";
import { OwnCollapse } from "..";

const dataSource = [
  {
    name: "select",
    placeholder: "placeholder",
    type: "select", // input
    option: [
      {
        key: "key",
        value: "value",
      },
    ],
  },
  {
    name: "time",
    placeholder: "placeholder",
    type: "date",
    picker: "year",
    format: "YYYY-MM-DD",
  },
  {
    text: "label",
    name: "checkbox",
    type: "checkbox",
  },
];
const dataSource1 = [
  {
    name: "checkbox",
    element: <Input placeholder="请输入关键字" />,
  },
  {
    name: "select",
    placeholder: "placeholder",
    type: "select", // input
    option: [
      {
        key: "key",
        value: "value",
      },
    ],
  },
];
const Index: FC = (): ReactElement => {
  return (
    <Fragment>
      <SearchForm />
      <OwnCollapse title="基本用法">{basicCode}</OwnCollapse>
      <SearchForm dataSource={dataSource} isReset automatic />
      <OwnCollapse title="重置与受控搜索">{resetCode}</OwnCollapse>
      <SearchForm dataSource={dataSource1} />
      <OwnCollapse title="自定义节点" text={"element的优先级高于type"}>
        {customCode}
      </OwnCollapse>
    </Fragment>
  );
};
export default Index;
